﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cocos2d;
using Meteorite;
using Microsoft.Xna.Framework;
using System.Diagnostics;
using ChaseCameraSample;

using OpenXLive;
using OpenXLive.Forms;
using OpenXLive.Features;
using Microsoft.Xna.Framework.Input;
using Microsoft.Phone.Tasks;

namespace Meteorite
{
    public class CreditsScene : CCScene, ICCTargetedTouchDelegate
    {
        

        public CreditsScene()
        {
            CCSize size = CCDirector.sharedDirector().getWinSize();

            //Title
            CCPoint p = new CCPoint(GameConstant.Point_CenterTop.x, GameConstant.Point_CenterTop.y-50);
            CCLabelBMFont Title = CCLabelBMFont.labelWithString(GameConstant.MainMenuScene_Btn_Credits, GameConstant.Font_Futura_48);
            addChild(Title);
            Title.position = p;
            Title.scale = 2.0f;

            const float scale = 0.8f;
            const float offset = -37;
            CCPoint AnchorPoint = new CCPoint(0, 0);
            //
            CCPoint p1 = new CCPoint(0+60, p.y + offset*2);
            
            CCLabelBMFont str = CCLabelBMFont.labelWithString(GameConstant.String_Credits, GameConstant.Font_Futura_48);
            str.scale = scale;
            str.position = p1;
            str.anchorPoint = new CCPoint(0, 1); ;
            addChild(str);

            CCSprite sprCocos2dx = CCSprite.spriteWithFile(GameConstant.Texture_Powered);
            sprCocos2dx.anchorPoint = new CCPoint(0, 0);
            sprCocos2dx.position = new CCPoint(60, 0);
            sprCocos2dx.scale = 0.4f;
            addChild(sprCocos2dx);


            CCLabelBMFont strParticleEngine = CCLabelBMFont.labelWithString(GameConstant.String_ParticleEngine, GameConstant.Font_Futura_48);
            strParticleEngine.anchorPoint = new CCPoint(0, 0);
            strParticleEngine.position = new CCPoint(145, 55);
            strParticleEngine.scale = 0.56f;
            addChild(strParticleEngine);

            CCSprite sprOpenXLive = CCSprite.spriteWithFile(GameConstant.Texture_OpenXLiveIcon);
            sprOpenXLive.anchorPoint = new CCPoint(0, 0);
            sprOpenXLive.position = new CCPoint(130, 0);
            sprOpenXLive.scale = 1.5f;
            addChild(sprOpenXLive);

            CCSprite sprXnaer = CCSprite.spriteWithFile(GameConstant.Texture_Xnaer);
            sprXnaer.anchorPoint = new CCPoint(0, 0);
            sprXnaer.position = new CCPoint(435, 0);
            sprXnaer.scale = 0.8f;
            addChild(sprXnaer);



        }
        public override void onEnter()
        {
            CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, 0, true);
            base.onEnter();
        }

        public override void onExit()
        {
            CCTouchDispatcher.sharedDispatcher().removeDelegate(this);
            base.onExit();
        }
        public virtual void ccTouchEnded(CCTouch touch, CCEvent eventer)
        {

        }
        public virtual bool ccTouchBegan(CCTouch touch, CCEvent eventer)
        {
            /* bug
            if (CCDirector.sharedDirector().runningScene is CreditsScene)
            {
                //CCDirector.sharedDirector().popScene();
                Debug.WriteLine("ccTouchBegan");
                return false;
            }
            */
            return true;
        }

        public virtual void ccTouchMoved(CCTouch touch, CCEvent eventer)
        {
        
        }

        public void ccTouchCancelled(CCTouch pTouch, CCEvent pEvent)
        {
        }
        public void btnCallback(CCObject pSender)
        {

        }
    }
}
